package org.springblade.modules.repair.service.impl;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.desk.entity.Notice;
import org.springblade.modules.repair.entity.MaintainMsgRead;
import org.springblade.modules.repair.entity.UserNotice;
import org.springblade.modules.repair.enums.MsgStatusEnum;
import org.springblade.modules.repair.mapper.UserNoticeMapper;
import org.springblade.modules.repair.service.IUserNoticeService;
import org.springblade.modules.repair.vo.UserNoticeListVO;
import org.springframework.stereotype.Service;


/**
 * 用户通知表 服务实现类
 *
 * @author ysq
 * @since 2024-04-01
 */
@Service
public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, UserNotice> implements IUserNoticeService {

	@Override
	public IPage<UserNoticeListVO> listByCondition(IPage<Notice> page, Long currentUserId, String title) {
		return baseMapper.listByCondition(page, currentUserId, title);
	}

	@Override
	public Boolean readAll(Long userId) {
		return super.update(Wrappers.<UserNotice>lambdaUpdate().set(UserNotice::getCategory, 1).set(UserNotice::getUpdateTime, DateUtil.date()).eq(UserNotice::getUserId,userId));
	}
}
